/**
 * @file TEST_mid_Timer.c
 * @author Linquan  
 * @brief 
 * @version 1.0
 * @date 2024-06-14
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#include "app_config.h"
#if TEST_MID_TIMER
#include "mid_Timer.h"
#include <stdio.h>
#include "export.h"

#include <time.h>


uint8_t time_out = 0;

void Timer_1_callback()
{
    time_t current_timer;
    char *candlt;
    current_timer = time(NULL);
    candlt = ctime(&current_timer);
    printf("Timer_1_callback: %s\n", candlt);

    
}

void Timer_2_callback()
{
    printf("Timer_2_callback \n");
}

void Timer_3_callback()
{
    printf("Timer_3_callback \n");
}

void Timer_4_callback()
{
     printf("Timer_4_callback \n");
    
    time_out++;

    if(time_out > 5)
    {
        time_out = 0;
        B_GREEN_PRINT("four middle Timer is all delte \n");
        Mid_Timer_Reset(E_TIMER_1);
        Mid_Timer_Reset(E_TIMER_2);
        Mid_Timer_Reset(E_TIMER_3);
        Mid_Timer_Reset(E_TIMER_4);
       
     }
}

#define TIMER_CB(X)       Timer_##X##_callback
void TEST_mid_Timer()
{
    
    Mid_Timer_Set(  E_TIMER_1,
                    100,
                    TIMER_CB(1));

    Mid_Timer_Set(  E_TIMER_2,
                    200,
                    TIMER_CB(2));

     Mid_Timer_Set(  E_TIMER_3,
                    300,
                    TIMER_CB(3));
    
    Mid_Timer_Set(  E_TIMER_4,
                    400,
                    TIMER_CB(4));
}
EXPORT_Lv6_APP_SINGLE(TEST_mid_Timer, NULL);


#endif










